<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>首页 </title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <link href="css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
    <link href="css/materialdesignicons.min.css"  th:href="@{/css/materialdesignicons.min.css}" rel="stylesheet">
    <link href="css/style.min.css" th:href="@{/css/style.min.css}" rel="stylesheet"></head>

<body>
<div class="lyear-layout-web" id="mainContent">
    <div  th:if="${session.grade} eq 3">
        <div th:replace="~{main::rightbar}"></div>
    </div>
    <div  th:if="${session.grade} eq 1">
        <div th:replace="~{kfmain::kfrightbar}"></div>
    </div>
    <div  th:if="${session.grade} eq 2">
        <div th:replace="~{csmain::csrightbar}"></div>
    </div>
    <div class="lyear-layout-container">

        <header class="lyear-layout-header" th:fragment="topbar">

            <nav class="navbar navbar-default">
                <div class="topbar">

                    <div class="topbar-left">
                        <div class="lyear-aside-toggler">
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                        </div>
                        <span class="navbar-page-title"> bug管理 </span>
                    </div>
                    <div th:replace="~{main::bar}"></div>


                </div>
            </nav>

        </header>

        <main class="lyear-layout-content">

            <div class="container-fluid">

                <div class="row">
                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-header"><h4>添加bug</h4></div>
                            <div class="card-body" >
                                <form id="myform" onsubmit="return false;">
                                    <div class="form-group">
                                        <label for="bugname">bug名称</label>
                                        <input class="form-control" type="text" id="bugname" name="bugname" placeholder="请输入bug名称..">
                                    </div>
                                    <div class="form-group">
                                        <label for="grade">bug等级</label>
                                        <select class="form-control" id="grade" name="grade" size="1" style="width: 100%;height: 38px">
                                            <option value="0">请选择等级</option>
                                            <option value="1">1-一级</option>
                                            <option value="2">2-二级</option>
                                            <option value="3">3-三级</option>
                                            <option value="3">4-四级</option>
                                        </select>                                    </div>
                                    <div class="form-group">
                                        <label for="downid">指派给</label>
                                        <select data-placeholder="请选择实验室"  id="downid" name="downid"  class="form-control chosen-select" style="width: 100%; "  required >
                                            <option value="0">选择开发人员</option>
                                            <!--playerRoleList后台获取到的集合th:each进行遍历,playerRole作为集合对象的变量名称,th:value="${playerRole.id}作为value值				                        th:text="${playerRole.name}"作为需要显示的内容-->				                        <option th:each="role:${roleList}" th:value="${role.id}"				                                th:text="${role.role_desc}"></option>
                                            <option th:each="role:${userlist}" th:value="${role.id}"

                                                    th:text="${role.realname}"></option>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label for="bugmiaoshu">bug描述</label>
                                        <textarea class="form-control" id="bugmiaoshu" name="bugmiaoshu" rows="5" value="" placeholder="描述"></textarea>
                                    </div>
                                    <div class="form-group">
                                        <label for="fileName">图片</label>
                                        <input class="form-control" type="file" id="fileName" name="fileName">
                                    </div>
                                    <div class="form-group">
                                        <button class="btn btn-primary" onclick="subForm()">添加</button>
                                    </div>
                                </form>

                            </div>
                        </div>





                    </div>


                </div>

            </div>

        </main>
        <!--End 页面主要内容-->
    </div>
</div>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>

<!--图表插件-->
<script type="text/javascript" src="js/Chart.js"></script>

<script type="text/javascript">
    //别忘了导入该用的js文件

    function subForm() {


            var fd = new FormData($("#myform")[0]);
            $.ajax({
                url: "addbug",
                type: "POST",
                data: fd,
                processData: false,
                contentType: false,
                success: function (data) {
                    alert("Connection success");
                },
                error: function (data) {
                    alert("Connection error");
                }
            });
        
    }
</script>
</body>

</html>